﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using DAL;

namespace BLL
{
    public class AdminPage : System.Web.UI.Page
    {
        protected static DataClasses1DataContext ctx = new DataClasses1DataContext();
        /// <summary>
        /// 覆写页面预处理事件
        /// 验证用户是否登录
        /// </summary>
        protected override void OnPreInit(EventArgs e)
        {
            //判断会员是否登录
            if (Session["Admin"] == null)
            {
                Response.Redirect(ApplicationPath + "Admin/Login.aspx?Status=000", true);
            }
            else
            {
                Session["Admin"] = Session["Admin"].ToString();
            }
            base.OnPreInit(e);
        }
        /// <summary>
        /// 应用程序路径 如：/Release/ 或 /
        /// </summary>
        public string ApplicationPath
        {
            get
            {
                string path = HttpContext.Current.Request.ApplicationPath.ToString();
                if (path.Trim() != "/") //判断路径是否为“/”
                {
                    path += "/";
                }
                return path;
                //return Request.ApplicationPath.ToString();
            }
        }
    }
}
